/************************************************************************/
/*    Author: Scott Bevin                                               */
/************************************************************************/

#pragma once

#include <string>

#include "EntityComponentFactory.h"

namespace XF
{
	class EntityComponent;

	class EntityComponentMakerBase
	{
	protected:
		EntityComponentMakerBase(){}
		std::string mIDName;

	public:
		virtual EntityComponent* MakeComponent(GameEntity* owner) 
		{
			return NULL;
		}

		virtual ~EntityComponentMakerBase(){}
	};

	template<class T>
	class EntityComponentMaker : public EntityComponentMakerBase
	{
	public:
		EntityComponentMaker(std::string id)
		{
			mIDName = id;
			EntityComponentFactory::RegisterMaker(id, this);
		}

		EntityComponent* MakeComponent(GameEntity* owner)
		{
			return new T(owner, mIDName);
		}
	};
}

